package com.mlethe.android.demo.progress;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Handler;
import android.widget.SeekBar;
import android.widget.TextView;

import com.mlethe.android.demo.R;
import com.mlethe.library.widget.progress.CircleProgressView;
import com.mlethe.library.widget.progress.CustomProgressView;

public class MainProgressActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_progress);
        final CircleProgressView circleProgressView = findViewById(R.id.progress_circular_cpv);
        final SeekBar seekBar = findViewById(R.id.seekBar);
        final TextView progressTv = findViewById(R.id.progressTv);
        final CustomProgressView customProgressView = findViewById(R.id.customProgressView);
        circleProgressView.setDuration(2000);
        new Handler().postDelayed(() -> {
            circleProgressView.setProgress(20000);
//            customProgressView.setProgressResource(0);
        }, 4000);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                progressTv.setText(progress +  "%");
                customProgressView.setProgress(progress);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
        customProgressView.startAnimation();
    }
}
